package edu.bit.water.service;

import java.sql.SQLSyntaxErrorException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import edu.bit.water.dao.MetaSensorAssociationDao;
import edu.bit.water.entity.MetaSensor;

@Service
public class MetaSensorAssociationService {

	@Autowired
	private MetaSensorAssociationDao metaSensorAssociationDao;
	
	/**
	 * 
	 * @param metaSensor 元数据设备实体类
	 * @return 成功返回1，失败返回0
	 * @throws SQLSyntaxErrorException 
	 */
	@Transactional
	public int insertMetaSensorAssociation(MetaSensor metaSensor)  throws BadSqlGrammarException{
		int n = metaSensorAssociationDao.insertMetaSensorAsscoiation(metaSensor);
		return n;
	}
	/**
	 * 
	 * @param metaSensor 元数据设备实体类
	 * @return 成功返回1，失败返回0
	 */
	public int deleteMetaSensorAssociation(MetaSensor metaSensor) {
//		System.out.println(metaSensor.getColumnDefination());
		int n = metaSensorAssociationDao.deleteMetaSensorAsscoiation(metaSensor);
		return n;
	}
}
